package org.jeecg.modules.demo.domain.types.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.demo.domain.types.entity.CmsDomainType;

import java.util.List;
import java.util.Map;

/**
 * @Description: 领域分类
 * @Author: jeecg-boot
 * @Date:   2025-06-06
 * @Version: V1.0
 */
public interface CmsDomainTypeMapper extends BaseMapper<CmsDomainType> {

	/**
	 * 编辑节点状态
	 * @param id
	 * @param status
	 */
	void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);

	/**
	 * 【vue3专用】根据父级ID查询树节点数据
	 *
	 * @param pid
	 * @param query
	 * @return
	 */
	List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);

	/**
	 * 获取最大的code
	 * @param page
	 * @return
	 */
	@InterceptorIgnore(tenantLine = "true")
	@Select("SELECT type_code FROM cms_domain_type WHERE type_code IS NOT NULL AND pid=#{pid} ORDER BY type_code DESC")
    List<CmsDomainType> getMaxTypeCodeByPage(Page<CmsDomainType> page, String pid);

	@InterceptorIgnore(tenantLine = "true")
	@Select("SELECT type_code FROM cms_domain_type WHERE id = #{id}")
	CmsDomainType selectTypeCodeById(String id);

	List<CmsDomainType> get_doamin_type_by_code(@Param("typeCode") String typeCode);
}
